<template>
  <view class="body-content layout-column">
    <van-nav-bar title="我的" class="my_title" />
    <div class="content-wrap flex">
      <div class="my-info">
        <van-row
          class="my-info-wrapper"
          @click="goto('/pages/my/profile-info')"
        >
          <div class="avatar-col">
            <van-image
              class="avatar"
              round
              src="@/static/my/recommendreward.png"
            />
          </div>
          <div class="info-col">
            <div class="username">{{ userInfo.userName }}</div>
            <span class="authentication">{{ userInfo.roleName }}</span>
          </div>
          <!-- <div class="goin-img">
            <van-icon name="arrow" color="#ffffff" />
          </div> -->
        </van-row>
      </div>
      <div class="menus">
        <van-form class="form" label-width="80px">
          <van-cell-group inset>
            <van-field
              name="1"
              label="退出"
              readonly
              input-align="right"
              @click="onLogout"
            >
              <template #right-icon>
                <van-icon name="arrow" />
              </template>
            </van-field>
          </van-cell-group>
        </van-form>
      </div>
    </div>
    <TabBar :active="1" />
  </view>
</template>

<script>
import { logout } from "@/api/user.js";
import TabBar from "@/components/tab-bar";
export default {
  components: {
    TabBar,
  },
  data() {
    return {
      myInfo: {
        avatar: "https://www.opqler.com/public/assets/img/avatar-place.png",
        shop_status: 2,
      },
      shop_status: "",
      showBalance: false,
      userInfo: uni.getStorageSync("userInfo"),
    };
  },
  onLoad() {},
  methods: {
    onLogout() {
      logout().then((res) => {
        if (res.code == 200) {
          uni.clearStorageSync();
          uni.showToast({
            title: "退出成功",
            icon: "none",
          });
          uni.navigateTo({
            url: "../login/index",
          });
        }
      });
    },
  },
};
</script>

<style>
Page {
  background-color: red;
}
</style>
<style lang="scss" scoped>
.body-content {
  font-family: PingFang SC;
  padding-bottom: 130rpx;
}

.my_title {
  z-index: 9998;
  background: #3325de;

  ::v-deep.van-nav-bar__title {
    font-size: 40rpx;
    font-weight: 600;
    color: #ffffff;
    font-family: PingFang SC;
  }
}

.my_title:after {
  border: none !important;
  border-bottom-width: 0;
}

.my-info {
  width: 100%;
  height: 440rpx;
  background-image: url("../../static/my/wod.png");
  background-size: 100% 100%;

  .my-info-wrapper {
    padding-top: 108rpx;
    height: 120rpx;
    display: flex;

    .avatar-col {
      flex: 1;
      text-align: right;
      max-width: 170rpx;

      .avatar {
        width: 114rpx;
        height: 114rpx;
        border: 5rpx solid #6d61e6;
      }
    }

    .info-col {
      flex: 1;
      padding-left: 20rpx;

      .username {
        font-size: 40rpx;
        font-weight: 600;
        line-height: 60rpx;
        color: #f0f0f0;
        max-width: 420rpx;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
      }

      .authentication {
        line-height: 60rpx;
        font-size: 20rpx;
        background-color: #6d61e6;
        color: #c8c7cc;
        width: auto;
        border-radius: 16rpx;
        padding: 8rpx;
      }
    }

    .goin-img {
      max-width: 85rpx;
      flex: 1;
      padding-right: 65rpx;
      text-align: right;
      line-height: 120rpx;

      .van-image {
        color: #c8c7cc;
        width: 16rpx;
        height: 32rpx;
      }
    }
  }
}

.sales-quota {
  color: #010101;
  margin: -63rpx 45rpx 0rpx 45rpx;
  background-color: #fff;
  height: 460rpx;
  border-radius: 5px;
  padding: 30rpx 20rpx 40rpx 20rpx;

  .quota-title {
    font-size: 33rpx;
    font-weight: 600;
  }

  .quota-money {
    margin-top: 57rpx;

    .money {
      font-size: 66rpx;
      font-weight: 600;
    }

    .dollar {
      font-size: 32rpx;
    }
  }

  .goin-img {
    text-align: right;

    .van-image {
      margin-top: 20rpx;
      width: 16rpx;
      height: 32rpx;
    }
  }

  .visits {
    color: #0c0c0c;

    .visits-col {
      .visits-item-title {
        margin-top: 31rpx;
        font-size: 27rpx;
      }

      .visits-item-value {
        margin-top: 30rpx;
        font-size: 33rpx;
        font-weight: 600;

        .dollar {
          font-size: 20rpx;
          font-weight: 300;
        }
      }
    }
  }
}

.menus {
  margin: 0 45rpx;
  background-color: #f0f1f5;

  .van-cell {
    ::v-deep.van-cell__title {
      font-size: 33rpx !important;
      font-weight: 600 !important;
    }
  }

  .form {
    padding: 20rpx 0;

    .van-cell-group {
      margin: 0;
    }

    .van-cell-group--inset {
      border-radius: 0;
      background-color: #f0f1f5;
    }

    .van-cell {
      border-radius: 7rpx;
      margin-bottom: 21rpx;
      padding: 40rpx 31rpx 40rpx 0rpx;
      display: flex;
      align-items: center;
      height: 112rpx;

      ::v-deep.van-cell__title {
        width: 400rpx !important;
        font-size: 33rpx;
        font-family: PingFang SC;
        font-weight: 400;
        color: #000000;
        padding-left: 31rpx;
      }
    }

    ::v-deep.van-field__control {
      //width: 90% !important;
      color: #3423da !important;
      height: 112rpx;
      font-size: 27rpx;
      font-family: PingFang SC;
      font-weight: 400;
      color: #5d5e60;
    }
  }
}

.adv-banner {
  margin: 0 45rpx 35rpx 45rpx;
  height: 131rpx;

  .adv-bg {
    background-image: url("../../static/my/my-bg2.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 131rpx;
  }

  .adv-col {
    color: #ffffff;
    line-height: 131rpx;
    text-align: center;
    font-size: 27rpx;

    .adv-join {
      border: 1px solid #c8c7cc;
      border-radius: 18px;
      padding: 2px 10px;
    }

    .adv-desc {
    }
  }
}

.tab-btn {
  margin: 0px 45rpx 45rpx 45rpx;

  .tab-btn-row {
    text-align: center;
    border-radius: 7rpx;
    background-color: white;
    padding: 60rpx;

    .tab-btn-row-image {
      height: 100rpx;
      width: 100rpx;
    }
  }
}
</style>